import React from 'react';
import { connect } from 'react-redux';
import reducer, { getOrderList, filter } from '../../store/user/order';
import commentReducer, {
  getDetail,
  openCommentModal,
  openUnCommentModal,
  setCommentOrder
} from '../../store/user/comment';
import MyComment from '../../components/user/Comment';
import { injectReducer } from '../../store/reducers';
import store from '../../store/createStore';
const mapStateToProps = state => ({
  list: state.order.list,
  datasource: state.order.datasource,
  loading: state.order.loading
});

const mapDispatchToProps = {
  getOrderList,
  filter,
  getDetail,
  openCommentModal,
  openUnCommentModal,
  setCommentOrder
};

injectReducer(store, { key: 'order', reducer });
injectReducer(store, { key: 'comment', reducer: commentReducer });
export default connect(
  mapStateToProps,
  mapDispatchToProps
)(MyComment);
